package com.moyun.zbmy.zizhou.beans;

import android.support.annotation.NonNull;
import android.text.TextUtils;

import com.moyun.zbmy.zizhou.application.Constances;
import com.moyun.zbmy.zizhou.ui.adapter.AttentionAdapter;
import com.ruihang.generalibrary.ui.util.IListData;
import com.ruihang.generalibrary.utils.IDataDate;
import com.moyun.zbmy.zizhou.ui.util.IListShowData;
import com.ruihang.generalibrary.utils.IShares;
import com.ruihang.generalibrary.utils.UrlUtils;

import java.io.Serializable;
import java.sql.Date;
import java.util.List;

/**
 * 公众号新闻数据（文章、视频、组图）
 */
public class AccountNewsItem implements IListShowData, IDataDate ,IShares,Serializable {

    private int newsDetailType;//": 1,
    private int newsDetailId;//": 470811,
    private String newsDetailTitle;//": "今天牛市",
    private String newsDetailText;//爆料类型的 内容
    private String newsDetailSmallImage;//": null,
    private List<ImageBean> newsDetailImages;//": null,
    private String newsDetailUrl;//": null,
    private String newsDetailCreateDate;//": "2020-02-27 16:28:09",
    private String newsDetailVideo;//视频地址

    private String followedName;//": "直播三台",
    private int followedId;//": 2071,
    private String followedSmallImage;//": "/sctv/405/image/public/201811/20181121175632_mhjwseteuk.jpg"
    private int followedStatus;

    private long newsDetailCommentCount;
    private long newsDetailAttitudesCount;//点赞数
    private boolean newsDetailAttitudesStatus;//当前用户是否点赞

    private boolean isShowAttention = false;

    private String newsDetailShareUrl;


    private int viewType;

    public int getNewsDetailType() {
        return newsDetailType;
    }

    public void setNewsDetailType(int newsDetailType) {
        this.newsDetailType = newsDetailType;
    }

    public int getNewsDetailId() {
        return newsDetailId;
    }

    public void setNewsDetailId(int newsDetailId) {
        this.newsDetailId = newsDetailId;
    }

    public String getNewsDetailTitle() {
        return newsDetailTitle;
    }

    public void setNewsDetailTitle(String newsDetailTitle) {
        this.newsDetailTitle = newsDetailTitle;
    }

    public String getNewsDetailSmallImage() {
        return newsDetailSmallImage;
    }

    public void setNewsDetailSmallImage(String newsDetailSmallImage) {
        this.newsDetailSmallImage = newsDetailSmallImage;
    }

    public String getNewsDetailUrl() {
        return newsDetailUrl;
    }

    public void setNewsDetailUrl(String newsDetailUrl) {
        this.newsDetailUrl = newsDetailUrl;
    }

    public String getNewsDetailCreateDate() {
        return newsDetailCreateDate;
    }

    public void setNewsDetailCreateDate(String newsDetailCreateDate) {
        this.newsDetailCreateDate = newsDetailCreateDate;
    }

    public String getFollowedName() {
        return followedName;
    }

    public void setFollowedName(String followedName) {
        this.followedName = followedName;
    }

    public int getFollowedId() {
        return followedId;
    }

    public void setFollowedId(int followedId) {
        this.followedId = followedId;
    }

    public List<ImageBean> getNewsDetailImages() {
        return newsDetailImages;
    }

    public void setNewsDetailImages(List<ImageBean> newsDetailImages) {
        this.newsDetailImages = newsDetailImages;
    }

    public String getFollowedSmallImage() {
        return followedSmallImage;
    }

    public void setFollowedSmallImage(String followedSmallImage) {
        this.followedSmallImage = followedSmallImage;
    }

    public long getNewsDetailCommentCount() {
        return newsDetailCommentCount;
    }

    public void setNewsDetailCommentCount(long newsDetailCommentCount) {
        this.newsDetailCommentCount = newsDetailCommentCount;
    }

    public long getNewsDetailAttitudesCount() {
        return newsDetailAttitudesCount;
    }

    public void setNewsDetailAttitudesCount(long newsDetailAttitudesCount) {
        this.newsDetailAttitudesCount = newsDetailAttitudesCount;
    }

    public boolean isNewsDetailAttitudesStatus() {
        return newsDetailAttitudesStatus;
    }

    public void setNewsDetailAttitudesStatus(boolean newsDetailAttitudesStatus) {
        this.newsDetailAttitudesStatus = newsDetailAttitudesStatus;
    }

    public String getNewsDetailText() {
        return newsDetailText;
    }

    public void setNewsDetailText(String newsDetailText) {
        this.newsDetailText = newsDetailText;
    }

    public String getNewsDetailVideo() {
        return newsDetailVideo;
    }

    public void setNewsDetailVideo(String newsDetailVideo) {
        this.newsDetailVideo = newsDetailVideo;
    }

    public int getFollowedStatus() {
        return followedStatus;
    }

    public void setFollowedStatus(int followedStatus) {
        this.followedStatus = followedStatus;
    }

    public boolean isShowAttention() {
        return isShowAttention;
    }

    public void setShowAttention(boolean showAttention) {
        isShowAttention = showAttention;
    }

    public String getNewsDetailShareUrl() {
        return newsDetailShareUrl;
    }

    public void setNewsDetailShareUrl(String newsDetailShareUrl) {
        this.newsDetailShareUrl = newsDetailShareUrl;
    }

    public int getViewType() {
        return viewType;
    }

    public void setViewType(int viewType) {
        this.viewType = viewType;
    }

    @Override
    public Date getDataDate() {
        return null;
    }

    @Override
    public void setDataDate(Date date) {

    }

    @NonNull
    @Override
    public String getDatePattern() {
        return "yyyy-MM-dd HH:mm";
    }

    @Override
    public String getDateString() {
        return newsDetailCreateDate;
    }

    @Override
    public String getTime() {
        return newsDetailCreateDate;
    }

    @Override
    public IListShowData getOwenerData() {
        return null;
    }

    @Override
    public String getDataTitle() {
        return newsDetailTitle;
    }

    @Override
    public String getDataImg() {
        return newsDetailSmallImage;
    }

    @Override
    public String getDataTag() {
        return null;
    }

    @Override
    public String getDataId() {
        return null;
    }

    @Override
    public int getDataType() {
        if (newsDetailType < 100) {
            viewType = AttentionAdapter.VIEWTYPE_NEWS_ITEM;
        } else {
            viewType = AttentionAdapter.VIEWTYPE_NEWS_IMG_ITEM;
        }
        return viewType;
    }

    @Override
    public int getDataViewType() {
        if (newsDetailType < 100) {
            viewType = AttentionAdapter.VIEWTYPE_NEWS_ITEM;
        } else {
            viewType = AttentionAdapter.VIEWTYPE_NEWS_IMG_ITEM;
        }
        return viewType;
    }

    @Override
    public IListData getOwner() {
        return null;
    }

    @Override
    public String getShareTitle() {
        return newsDetailText;
    }

    @Override
    public String getShareH5() {
        return null;
    }

    @Override
    public String getShareImage() {
        return newsDetailSmallImage;
    }

    @Override
    public String getShareDigest() {
        return null;
    }

    @Override
    public String getShareURL() {
        if(TextUtils.isEmpty(newsDetailShareUrl)){
            return null;
        }else {
            return UrlUtils.linkUrls(Constances.ST_BASE_URL,newsDetailShareUrl);
        }
    }
}
